﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace TooMuchToDo.MiniGames
{
    public class Interpilation
    {
        private float _value;
        private float _endingValue;
        public Interpilation(float start)
        {
            _value = start;
            _endingValue = _value;
        }

        public float getValue()
        {
            return _value;
        }
        public void GoTo(float value)
        {
            _endingValue = value;
        }
        public void Update(float Rate)
        {
            if (_value != _endingValue)
            {
                if (_value > _endingValue)
                {
                    _value -= Rate;
                    if (_value < _endingValue)
                    {
                        _value = _endingValue;
                    }
                }
                else
                {
                    _value += Rate;
                    if (_value > _endingValue)
                    {
                        _value = _endingValue;
                    }
                }
            }
        }
    }
}
